package com.xxx.dict.service.impl;

import com.github.pagehelper.PageHelper;
import com.xxx.dict.domain.DictItem;
import com.xxx.dict.mapper.DictItemMapper;
import com.xxx.dict.query.DictItemQuery;
import com.xxx.dict.service.IDictItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author BoWei Wang
 * @date 2025/8/5
 */
@Service
public class DictItemServiceImpl implements IDictItemService {
    @Autowired
    private DictItemMapper dictItemMapper;

    @Override
    public List<DictItem> findAll() {
        return dictItemMapper.findAll();
    }

    @Override
    public DictItem findOne(Long id) {
        return dictItemMapper.findOne(id);
    }

    @Override
    public List<DictItem> queryPage(DictItemQuery dictItemQuery) {
        PageHelper.startPage(dictItemQuery.getCurrentPage(), dictItemQuery.getPageSize());
        return dictItemMapper.queryPage(dictItemQuery);
    }

    @Override
    public void addDictItem(DictItem dictItem) {
        dictItemMapper.addDictItem(dictItem);
    }

    @Override
    public void updateDictItem(DictItem dictItem) {
        dictItemMapper.updateDictItem(dictItem);
    }

    @Override
    public void deleteDictItem(Long id) {
        dictItemMapper.deleteDictItem(id);
    }

    @Override
    public void batchDeleteDictItems(Long[] ids) {
        dictItemMapper.batchDeleteDictItems(ids);
    }

    @Override
    public List<DictItem> getByDictId(Long dictId) {
        return dictItemMapper.getByDictId(dictId);
    }

}
